package com.homework.ch10;

/**
 * @author yuxi
 * @version 1.0
 * @date 2025/10/14
 * @Description:
 */
public class Test6 {
    public static void main(String[] args) {
        //New->[Runnable->Running->Timed_Wating]->Runnable->Running->Terminated
        Thread t2=new Thread(()->{
            for(char i='A';i<='Z';i++){
                System.out.println("t2:"+i);
                try {
                    Thread.sleep(10);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        Thread t1=new Thread(){
            public void run(){
                for(int i=1;i<51;i++){
                    System.out.println("t1:"+i);
                    try {
                        if(i==30){
                            t2.join();
                        }
                        Thread.sleep(5);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        };
        t1.start();
        t2.start();
    }
}